﻿using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;

namespace JTLeigh.Commerce.Spencer.Core.Data.Exceptions
{

	/// <summary>
	/// <see langword="abstract"/> base class for all database exceptions.
	/// </summary>
	[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The names of abstract base classes should end with 'Base'.")]
	[Serializable]
	public abstract class DatabaseExceptionBase : Exception
	{

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="DatabaseExceptionBase"/> class.
		/// </summary>
		protected DatabaseExceptionBase()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="DatabaseExceptionBase"/> class with the 
		/// specified message.
		/// </summary>
		/// <param name="message">The message that describes the failed assertion.</param>
		protected DatabaseExceptionBase(string message)
			: base(message)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="DatabaseExceptionBase"/> class with the 
		/// specified message and inner exception.
		/// </summary>
		/// <param name="message">The message that describes the failed assertion.</param>
		/// <param name="innerException">The <see cref="Exception"/> that is the root cause of 
		/// the exception being thrown.</param>
		protected DatabaseExceptionBase(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="DatabaseExceptionBase"/> class as a result of 
		/// serialization.
		/// </summary>
		/// <param name="info">The <see cref="SerializationInfo"/> object that holds serialized 
		/// object information about the exception being thrown.</param>
		/// <param name="context">The <see cref="StreamingContext"/> object that contains 
		/// contextual information about the source and the destination.</param>
		protected DatabaseExceptionBase(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		#endregion // Constructors

	}

}
